package compoundDB;

import compoundDB.gui.ResultsScreen;
import java.sql.SQLException;

import compoundDB.core.GUIController;
import compoundDB.core.GUIControllerImpl;
import compoundDB.database.DBManager;
import compoundDB.database.DatabaseAccessor;
import compoundDB.io.IOController;


public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {
    	IOController.loadPlugins();
    	    	
    	DatabaseAccessor dba;
		GUIController guiController;		
		
		try
		{
			dba = new DBManager();
		}
		catch (ClassNotFoundException exc)
		{
			System.out.println("Database library could not be loaded.");
			return;
		}
		try
		{
			guiController = new GUIControllerImpl(dba);
		}
		catch (SQLException exc)
		{
			System.out.println("Database connection failed.");
			System.out.println(exc.getMessage());
			return;
		}
    	
		new ResultsScreen(guiController);
    }

}
